package puntaelena.facilitylocation.hillclimbing.solver;

import java.util.ArrayList;
import java.util.List;

import puntaelena.facilitylocation.hillclimbing.solver.constructions.HillClimbingConstructionsFront;
import puntaelena.graphsupport.solver.IFacilityLocationSolver;

import jfuzzyprincepless.algorithm.structure.CompoundConstruction;
import jfuzzyprincepless.algorithm.structure.INegotiationConstruction;
import puntaelena.graphsupport.GraphSupportFront;

/**
 * front
 */
public class PEHillClimbingAlgorithmBuilder {
	public static final IFacilityLocationSolver FACTOR3_SOLVER =
		GraphSupportFront.getFactor3Solver();

	private List<INegotiationConstruction> algorithm =
		new ArrayList<INegotiationConstruction>();

	public void addForAllCitiesRelinkTheBest() {
		INegotiationConstruction forAllCitiesChooseTheBest =
			HillClimbingConstructionsFront.createFORAllCitiesRelinkTheBest();
		algorithm.add(forAllCitiesChooseTheBest);
	}

	public void addForChpUsflClsdFcltOpenRelikn() {
		INegotiationConstruction forGoodFacilitiesRelink =
			HillClimbingConstructionsFront.createFORChpUsflClsdFcltOpenRelikn();
		algorithm.add(forGoodFacilitiesRelink);
	}

	public void addForFacilitySearchesAndClosesEnemies() {
		INegotiationConstruction forGoodFacilitiesRelink =
			HillClimbingConstructionsFront.createFORFacilitySearchesAndClosesEnemies();
		algorithm.add(forGoodFacilitiesRelink);
	}

	public void addWhileClosedFacilitiesCoalitions() {
		INegotiationConstruction forGoodFacilitiesRelink =
			HillClimbingConstructionsFront.createWHILEClosedFacilitiesCoalitions();
		algorithm.add(forGoodFacilitiesRelink);
	}

	public IFacilityLocationSolver build() {
		return new HillClimbingSolver(
			FACTOR3_SOLVER,
			buildConstruction()
		);
	}

	public INegotiationConstruction buildConstruction() {
		CompoundConstruction algorithm =
			new CompoundConstruction(this.algorithm);
		return algorithm;
	}
}
